#include<iostream>
using namespace std;
int n;
long long k=0;
int main(){
    freopen("color.in","r",stdin);
    freopen("color.out","w",stdout);
    int T;
    cin>>T;
    while(T--){
        int a[200005]={0};
        k=0;
        cin>>n;
        for(int i=1;i<=n;i++){
                int x;
                cin>>x;
                a[x]++;
        }
        for(int i=1;i<=200000;i++){
            if(a[i]%2==0)k+=a[i]/2*i;
        }
        cout<<k<<endl;
    }
    return 0;
}
